<template>
  <div>
    <el-dialog
        :modal="true"
        :modal-append-to-body="true"
        :title="tittle"
        v-model="isShow"
        :width="width"
        :height="height"
        :close-on-click-modal="false"
        :show-close="true"
        :close-on-press-escape="true"
        center
    >
      <div style="margin-left: 15%">
      <span>确定删除员工”{{name}}“吗</span>
        <el-button @click="cancel()" class="dialog-footer">取 消</el-button>
        <el-button type="primary" @click="submit()" class="dialog-footer">确 定</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
export default {
  props: {
    switchStyle: {
      type: Boolean,
      default: true
    },
    tittle: {
      type: String,
      default: '删除送水工信息'
    },
    width: {
      type: String,
      default: "20%"
    },
    height: {
      type: String,
      default: "200px"
    },
  },
  data() {
    return{
      isShow:false,
      name:'',
      id:''
    }
  },
  methods: {
    init(id,name) {
      var that = this;
      that.isShow = true;
      this.name=name;
      this.id=id;
    },
    cancel(){
      this.isShow = false
    },
    submit(){
      var that=this;
      this.axios
          .get("/worker/del/"+this.id)
          .then(function (response) {
            that.isShow = false;
            that.$parent.fresh();
            console.log(response);
          })
          .catch(function (error) {
            console.log(error);
          });

    }
  }
}
</script>
<style scoped>
.dialog-footer button:first-child {
  margin-right: 10px;
}
</style>
